<!DOCTYPE html>
<html>
<head>
    <script src="../build/react.js"></script>
    <script src="../build/react-dom.js"></script>
    <script src="../build/browser.min.js"></script>
</head>
<body>
<div id="example"></div>
<script type="text/babel">

    function Mailbox(props) {
        const unreadMessages = props.unreadMessages;
        return (
                <div>
                    <h1>Hello!</h1>
                    {unreadMessages.length > 0 &&
                    <h2>
                        You have {unreadMessages.length} unread messages.
                    </h2>
                    }
                    <div>
                        {unreadMessages.length ? (

                            <h2>
                            You have {unreadMessages.length} unread messages.
                            </h2>
                        ) : (
                                <h2>
                                    You have 0 unread messages.
                                </h2>
                        )}
                    </div>

                </div>
        );
    }

    const messages = ['React', 'Re: React', 'Re:Re: React'];
    ReactDOM.render(
            <Mailbox unreadMessages={messages} />,
        document.getElementById('example')
    );

</script>
</body>
</html>

